package dao;

import model.Administrator;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import utils.DataSourceUtils;

import java.sql.SQLException;

public class AdminstratorDao {
    public Administrator selectByUsernamePassword(String account, String password) throws SQLException {
        QueryRunner r = new QueryRunner(DataSourceUtils.getDataSource());
        String sql = "select * from administrator where account=? and password=?";
        return r.query(sql, new BeanHandler<Administrator>(Administrator.class), account, password);
    }
}
